﻿using Furion;
using Furion.DynamicApiController;
using GWB.Application.Common;
using GWB.Application.System.LogManage.Dtos;
using GWB.Application.System.LogManage.LogService;
using GWB.Core;
using GWB.Core.Enum;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GWB.Application.System.LogManage
{
    /// <summary>
    /// 日志管理
    /// </summary>
    [ApiDescriptionSettings("系统管理", Tag = "日志管理", SplitCamelCase = false)]
    public class LogAppService : IDynamicApiController
    {
        /// <summary>
        /// 请求日志
        /// </summary>
        [Authorization(Name = "查询请求日志")]
        public async Task<PageResult<RequestLogOutDto>> RequestLogPage(RequestLogPageInputDto inputDto)
        {
            return await App.GetService<ILogService>().RequestLogPage(inputDto);
        }

        /// <summary>
        /// 查询请求日志详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [Authorization(Name = "查询请求日志详情")]
        public async Task<RequestLogOutDto> GetRequestLogInfo(long id)
        {

            return await App.GetService<ILogService>().GetRequestLogInfo(id);
        }



        /// <summary>
        /// 错误日志
        /// </summary>
        [Authorization(Name = "查询错误日志")]
        public async Task<PageResult<ErrorLogOutDto>> ErrorLogPage(ErrorLogPageInputDto inputDto)
        {
            return await App.GetService<ILogService>().ErrorLogPage(inputDto);
        }
    }
}